# -*- coding: utf-8 -*-
from django.contrib.comments.signals import comment_was_posted
from django.dispatch.dispatcher import receiver
from django.contrib.comments.models import Comment
from django.core.mail import send_mail

@receiver(comment_was_posted, sender=Comment)
def comment_notification(sender, **kwargs):
    comment = kwargs ['comment']
    subject = 'New Comment by ' + comment.user_name
    msg = 'Comment text:\n' + comment.comment + '\n' + comment.url
    send_mail(subject, msg, 'carlosvin@alwaysdata.net', ['carlosvin@gmail.com'],  fail_silently=True)
    